<template>
  <el-dialog
    title="内容审批"
    :visible.sync="visible"
    :append-to-body="true">
    <p class="part-title" style="margin-top: 10px;">账号：{{account}}</p>
    <p class="part-title"  ><span style="float: left;margin-top: 1px;"">违规下线理由</span>
      <el-form  :model="dataForm"  ref="dataForm" @keyup.enter.native="messagePush()"style="float: left;margin-left: 10px;margin-top: -5px;"">
       <el-form-item   prop="messageContent">
         <el-input  type="textarea" v-model="dataForm.messageContent" ></el-input>
        </el-form-item>
      </el-form>
    </p>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="messagePush()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  /* eslint-disable */
  export default {
    data () {
      return {
        visible: false,
        uuid:'',
        experimentName:'',
        account:'',
        userName:'',
        dataForm: {
          messageContent:''
        },
      }
    },
    computed: {
      mainTabs: {
        get () { return this.$store.state.common.mainTabs },
        set (val) { this.$store.commit('common/updateMainTabs', val) }
      }
    },
    methods: {
      // 初始化
      init (uuid,experimentName,userName,account) {
        this.visible = true
        this.uuid = uuid,
        this.experimentName = experimentName,
        this.userName = userName,
        this.account = account
      },
      messagePush () {
        this.$http({
          url: this.$http.adornUrl('/adminMessage/saveMessage'),
          method: 'post',
          data: this.$http.adornData({
            'account': this.account,
            'messageType': 1,
            'read': 0,
            'experimentName': this.experimentName,
            'userName':this.userName,
            'messageContent': this.dataForm.messageContent
          })
        }).then(({data}) => {
          if (data.success) {
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.visible = false
               this.$emit('refreshDataList')
              }
            })
          } else {
            this.$message.error(data.message)
          }
        })
      },
    }
  }
</script>
<style lang="scss" scoped>
  .part-title {
      margin: 20px 0;
      color: #000;
      padding-left: 1em;
      font-size: 16px;
      position: relative;
      display: inline-block;
      width: 100%;
  }
  .part-title:before{
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 3px;
    height: 1em;
    background-color: #4976e8;
  }
  .el-button--primary {
       color: #fff;
       background-color: #273471 !important;
       border-color: #273471 !important;
       }
</style>
